From 8ca6bbbfc0c960871ca0b191681552d09462f837 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Tue, 14 Dec 2010 15:52:40 +0900 Subject: [PATCH] Make GtkCellArea independantly GtkBuildable. Simply use the GtkCellLayoutIface hooks for this. --- gtk/gtkcellarea.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 59a1d015d4..079ab56afe 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -425,7 +425,15 @@ static void gtk_cell_area_reorder (GtkCellLayout GtkCellRenderer *cell, gint position); static GList *gtk_cell_area_get_cells (GtkCellLayout *cell_layout); +static GtkCellArea *gtk_cell_area_get_area (GtkCellLayout *cell_layout); +/* GtkBuildableIface */ +static void gtk_cell_area_buildable_init (GtkBuildableIface *iface); +static void gtk_cell_area_buildable_custom_tag_end (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + gpointer *data); /* Used in foreach loop to check if a child renderer is present */ typedef struct { @@ -560,10 +568,11 @@ static guint cell_area_signals[LAST_SIGNAL] = { 0 }; #define PARAM_SPEC_PARAM_ID(pspec) ((pspec)->param_id) #define PARAM_SPEC_SET_PARAM_ID(pspec, id) ((pspec)->param_id = (id)) - G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkCellArea, gtk_cell_area, G_TYPE_INITIALLY_UNOWNED, G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, - gtk_cell_area_cell_layout_init)); + gtk_cell_area_cell_layout_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, + gtk_cell_area_buildable_init)) static void gtk_cell_area_init (GtkCellArea *area) @@ -1328,6 +1337,7 @@ gtk_cell_area_cell_layout_init (GtkCellLayoutIface *iface) iface->clear_attributes = gtk_cell_area_clear_attributes; iface->reorder = gtk_cell_area_reorder; iface->get_cells = gtk_cell_area_get_cells; + iface->get_area = gtk_cell_area_get_area; } static void @@ -1452,6 +1462,33 @@ gtk_cell_area_get_cells (GtkCellLayout *cell_layout) return g_list_reverse (cells); } +static GtkCellArea * +gtk_cell_area_get_area (GtkCellLayout *cell_layout) +{ + return GTK_CELL_AREA (cell_layout); +} + +/************************************************************* + * GtkBuildableIface * + *************************************************************/ +static void +gtk_cell_area_buildable_init (GtkBuildableIface *iface) +{ + iface->add_child = _gtk_cell_layout_buildable_add_child; + iface->custom_tag_start = _gtk_cell_layout_buildable_custom_tag_start; + iface->custom_tag_end = gtk_cell_area_buildable_custom_tag_end; +} + +static void +gtk_cell_area_buildable_custom_tag_end (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + gpointer *data) +{ + /* Just ignore the boolean return from here */ + _gtk_cell_layout_buildable_custom_tag_end (buildable, builder, child, tagname, data); +} /************************************************************* * API * -- 2.30.2